
 <link href="/assets/frame/layui/plugins/formSelectes/formSelects-v4.css" rel="stylesheet">

<link href="/assets/admin/css/artilce-edit.css" rel="stylesheet">
 
<link href="/assets/plugins/editor/css/editormd.css"  rel="stylesheet">

<script type="text/javascript">
function getInitTags(){
    let tags=new Array(#for(atag:aTags)  '#(atag.mname)', #end);
   
    return tags;
}

function getThumbImg(){
    return '#(article.thumbImg??)';
}


 
</script>
 
<script type="text/html" id="content">#(article.content ?? '')</script>
<style>
 .layui-input-block{
    margin-left:24px;
}
.article-edit .select2-container-multi .select2-choices{
    height: 34px!important;
    border: 1px solid #D2D2D2!important;
    background-image: none;
}
.article-edit .select2{
	padding-top: 1px;
}

.article-edit .select2-container-multi .select2-choices .select2-search-choice {
    margin: 6px 0 3px 5px!important;
}

.article-edit #[[#]]#switch-btn{
	float: right;
}
</style>
 
<div class="article-edit layui-form" lay-filter="article-edit" >
 
	<div class="layui-row">
		<div class="layui-col-lg12 layui-col-md12">
			<blockquote class="page-title">#(article==null?"发表文章":"修改文章")</blockquote>
		</div>
	</div>
	<div class="layui-row" >
		<div class="layui-col-md6">
			<div class="layui-form-item">
			  <div class="layui-input-block">
			  	<input type="hidden" name="isTop" value="#(article.isTop??false)">
			  	<input type="hidden" name="allowComment" value="#(article.allowComment??true)">
			  	<input type="hidden" name="isOriginal" value="#(article.isOriginal??true)">
			  	<input type="hidden" name="contentType" value="#(article.contentType??'html')" id="contentType" >
		      	<input type="text" name="title" required  value="#(article.title??)"  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
		        <input type="hidden" name="id" value="#(article.id??)">
		         <input type="hidden" name="thumbImg" value="#(article.thumbImg??)">
		       </div> 
		    </div>
		</div>
		<div class="layui-col-md6">
			<div class="layui-form-item">
			  <div class="layui-input-block">
		      	<input type="text" name="identify" required  value="#(article.identify??)"   placeholder="请输入访问路径" autocomplete="off" class="layui-input">
		      </div> 
	      	</div>
		</div>
	</div>
	<div class="layui-row">
		<div class="layui-col-md6">
		 	<div class="layui-form-item">
			  <div class="layui-input-block">
		      	<div class="tags layui-input" id="tags">
                    <input type="text" name="articleTags" id="articleTags" placeholder="请输入标签" autocomplete="off">
                </div>
		      </div> 
	      	</div>
		</div>
		<div class="layui-col-md6">
		 	<div class="layui-form-item">
		 	 	<div class="layui-input-block">
		 	 		<select multiple="multiple"  lay-ignore xm-select="article-edit-catgeory-select" xm-select-search=""  >
		 	 			#for(category:allCategory)
		 	 				<option value="#(category.id)"
		 	 				 #for(aCategory:aCategorys)
		 	 					#if(aCategory.id==category.id)
		 	 						selected
		 	 					#end
		 	 					#(aCategory.id)
		 	 				#end>#(category.mname)</option>
		 	 			#end
                      </select>

		 	   </div> 
		 	</div> 
		</div>
	</div>
		<div class="layui-row">
		<div class="layui-col-md6">
		 	<div class="layui-form-item">
                 <div class="layui-input-block"> 
                    <button class="layui-btn layui-btn-primary layui-btn-sm article-upload-thumb">上传封面</button>
                    <button class="layui-btn layui-btn-primary layui-btn-sm article-thumb-preview" style='display:none;' >预览封面</button>
                    <span class="article-auto-save-msg"></span>
                 </div>
 		 	</div>
		</div>
		<div class="layui-col-md6">
		 	<div class="layui-form-item">
                
                <button class="layui-btn layui-btn-primary layui-btn-sm switch-editor" data-editor="editormd" >Markdown编辑器</button>
                <button class="layui-btn layui-btn-primary layui-btn-sm switch-editor" data-editor="ueditor" >富文本编辑器</button>
		 	</div>
		</div>
	</div>
	<div class="layui-row">
		<div class="layui-col-md12 "  id="html-container">
			<div class="layui-form-item">
				<div class="layui-input-block" id="article-ueditor-container">
				 	<script id="article-ueditor" name="content" type="text/plain">
        				
    				</script>
	    		</div>
    		</div>
		</div>
		<div class="layui-col-md12  " id="md-container">
			<div class="layui-form-item">
				<div class="layui-input-block">
				 	<div id="meditor">
				 	</div>
	    		</div>
    		</div>
		</div>
		<div class="layui-col-md12" >
			<div class="layui-form-item">
				<div class="layui-input-block">
				 <div class="layui-inline">
				    <label class="layui-form-label">置顶</label>
				    <div class="layui-input-inline" style="width: 100px;">
					<input type="checkbox" lay-filter="isTop"    #((article==null||!article.isTop)?'':'checked') lay-skin="switch" lay-text="开启|关闭">				    </div>
				  </div>
				  <div class="layui-inline">
				    <label class="layui-form-label">原创</label>
				    <div class="layui-input-inline" style="width: 100px;">
					<input type="checkbox" lay-filter="isOriginal"    #((article==null||article.isOriginal)?'checked':'') lay-skin="switch" lay-text="开启|关闭">				    </div>
				  </div>
				   <div class="layui-inline">
				    <label class="layui-form-label">允许评论</label>
				    <div class="layui-input-inline" style="width: 100px;">
					<input type="checkbox" lay-filter="allowComment"   #((article==null||article.allowComment)?'checked':'')     lay-skin="switch" lay-text="开启|关闭">				    </div>
				   </div>
				  	<div class="layui-inline" style="float:right;">
				  		<button class="layui-btn layui-btn-normal" lay-submit lay-filter="publish">发布</button>
				  		<button class="layui-btn layui-btn-warm"  lay-submit  lay-filter="draft" >存为草稿</button>
				  	</div>
				</div>
			</div>
		</div>
	</div>
	
</div>

<script src="/assets/plugins/turndown/turndown.js"></script>
<script>
    function pjaxLoad(){
      layui.use(['articleEdit'],function(articleEdit){
        articleEdit.pjaxLoad();
      })
    }
    function firstLoad(){
      layui.use(['articleEdit'],function(articleEdit){
        
      })
    }
 </script>